
import json
import os

import openai

openai.api_key = os.environ["OPENAI_API_KEY_ZHIHU"]
openai.api_base= os.environ["OPENAI_API_BASE_ZHIHU"]

speech_file_path = "speech.mp3"
response = openai.Audio.create(
  model="tts-1",
  voice="alloy",
  input="Today is a wonderful day to build something people love!"
)

response.stream_to_file(speech_file_path)